package com.atguigu.reflect;

import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

/**
 * @program: IDEAcode
 * @description:
 * @author: Mr.zjx
 * create: 2021-07-23-00-23
 **/
public class Demo {
    private FileOutputStream fos = null;

    @Before
    //在test方法前面执行
    public void before() throws FileNotFoundException {
        fos = new FileOutputStream("");
    }
    @After
    //在test方法之后执行
    public void after() throws IOException {
        if (fos != null)
            fos.close();
    }

    @Test
    public void writeFile() throws IOException {
        fos.write(101);
    }
}
